package com.foxit.pdf2html5.web.util;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class PropertiesUtil {
	
	private static InputStream in;
	
	private static Properties properties;
	
	public static String propertyname ="config.properties";
	
	private static void loadProperties(InputStream in) throws IOException{
		properties.load(in);
	}
	
	private static InputStream getFileInputStream() throws FileNotFoundException {
		return Thread.currentThread().getContextClassLoader().getResourceAsStream(propertyname);
	}
	/**
	 * @Description:
	 * @param name
	 * @return
	 * @throws IOException
	 * @return String
	 * @date Jan 6, 2010
	 */
	public static String getProperty(String name) throws IOException{
		in =getFileInputStream(); 
		properties = new Properties();
		loadProperties(in);
		in.close();
		return properties.getProperty(name);
	}

}
